<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
<head></head>
<body>


	<!-- Menu -->
	<%@ include file="/WEB-INF/views/demo/common.jsp" %>




	<h2>Google 뉴스 단어별 빈도 정보</h2>
	<p>MongoDB + Spring Data</p>

	<p>총 카운트 : ${_totalCount}</p>

	<p>
		인기단어 Best5<br>
	 	<c:if test="${!empty _bestWordList}">
		<c:forEach var="bestWord" items="${_bestWordList}">
		    [ ${bestWord.word} ] : [ ${bestWord.count}회 ]<br>
		</c:forEach>
		</c:if>	
	</p>


	<input id="id_txt_word" placeholder="Search Word..." data-type="search" class="ui-input-text ui-body-c">
	<a href="#" id="id_btn_search" data-role="button" data-icon="search" data-iconpos="right" data-inline="true">Search</a>
	
	
	<table data-role="table" id="movie-table" data-mode="reflow" class="ui-responsive table-stroke">
	  <thead>
	    <tr>
	    	<th data-priority="1">NO</th>
	    	<th data-priority="2">WORD</th>		
	      	<th data-priority="persist">COUNT</th>
	    </tr>
	  </thead>
	  <tbody>

	 	<c:if test="${!empty _objList}">
	 	<c:set var="tableNum">0</c:set>
		<c:forEach var="word" items="${_objList}">
		    <c:set var="tableNum">${tableNum+1}</c:set>
		    <tr>
		    	<th>${tableNum}</th>
		      	<td>${word.word}</td>
		      	<td>${word.count}</td>
		    </tr>
		</c:forEach>
		</c:if>

	  </tbody>
	</table>
	
	
	<script type="text/JavaScript">   
		$('#id_btn_search').click(function(e) {
			var word = $('#id_txt_word').val();
			location.href = '<c:url value="/" />app/news/searchNewsWordCount?word=' + encodeURI(word);
		});
	</script>
	
</body>
</html>
